
#pragma once

#ifndef __MSCTRL_SIM_ENGINE_HH__
#define __MSCTRL_SIM_ENGINE_HH__

#include <string>

#include "sim/event.hh"

namespace MsCtrl {

/**
 * \brief Engine object declaration
 *
 * Simulation engine object. MsCtrl::CPU will use this object to manage
 * events.
 */
class Engine {
 public:
  Engine() {}
  virtual ~Engine() {}

  /**
   * \brief Set functions
   *
   * As CPU manages all events in MsCtrl, we need method to invoke MsCtrl
   * event from outside of MsCtrl - especially in DMA completion.
   *
   * Provide two function, one for CPU work event, another for DMA interrupt
   * posting.
   */
  virtual void setFunction(EventFunction, InterruptFunction) = 0;

  /**
   * \brief Schedule event function
   *
   * Schedule event at provided tick. Reschedule if event is already scheduled.
   */
  virtual void schedule(uint64_t) = 0;

  //! Get current simulation tick in pico-second
  virtual uint64_t getTick() = 0;
};

}  // namespace MsCtrl

#endif
